// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import 'normalize.css'
import VideoPlayer from 'vue-video-player'
import fastClick from 'fastclick'
import 'amfe-flexible'
import 'animate.css'
import vueLaayload from 'vue-lazyload'
import BScroll from 'better-scroll'
import router from './router'
import http from './http'
import bus from './bus'

require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
// require('mockjs')
fastClick.attach(document.body)
Vue.use(VideoPlayer)
Vue.use(vueLaayload, {
  error: require('./assets/logo.png'),
  loading: require('./assets/zzjz.gif')
  // throttleWait: 5000
})
Vue.config.productionTip = false
Vue.prototype.$BS = BScroll
Vue.prototype.$bus = bus
Vue.prototype.$http = http

// Vue.directive('lazy', {
//   bind (el, binding) {
//     binding.cls = binding.name
//   }
//   // inserted (el, binding) {
//   //   let imgs = el.getElementsByTagName('img')
//   //   console.log(imgs[0])
//   //   // el.onscroll = function (e) {
//   //   //   let elScrollTop = el.scrollTop
//   //   //   for (let i = 0; i < imgs.length; i++) {
//   //   //     if (imgs[i].parentNode.offsetTop - elScrollTop <= 300) {
//   //   //       if (!imgs.readyLoad) {
//   //   //         imgs[i].src = imgs[i]['dataset'].src
//   //   //         imgs[i].readyLoad = true
//   //   //       }
//   //   //     }
//   //   //   }
//   //   // }
//   // }
// })
/* eslint-disable no-new */
new Vue({
  router
}).$mount('#app')
